package me.yricky.cov_spectrum.ui

import android.content.Context
import android.net.Uri
import androidx.browser.customtabs.CustomTabColorSchemeParams
import androidx.browser.customtabs.CustomTabsIntent
import androidx.compose.material.Colors
import androidx.compose.material.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.toArgb
import me.yricky.cov_spectrum.app

fun Context.openByWebView(url: String,colors:Colors) {
    val primaryColor: Int = colors.primary.toArgb()
    val secondaryColor: Int = colors.secondary.toArgb()
    CustomTabsIntent.Builder().setDefaultColorSchemeParams(
        CustomTabColorSchemeParams.Builder()
            .setToolbarColor(primaryColor)
            .setNavigationBarColor(primaryColor)
            .setSecondaryToolbarColor(secondaryColor)
            .build()
    ).build().launchUrl(this, Uri.parse(url))
}